package pony.model;

public class Hello {
	private String name;
	private double height;
	private double weight;
	private String telNum;
	private double bmiValue;
	
	public Hello() {
		super();
	}
	
	public String sayHello(String name) {
		this.name = name;
		return name + ", welcome to the J2EE world! This is Struts MVC framework";
	}
	
	public String showTelNum(String telNum) {
		this.telNum = telNum;
		return "hi " + name + " your tel num is " + this.telNum; 
	}
	
	public double doBMI(double h, double w) {
		height = h / 100;
		weight = w;
		bmiValue = weight / Math.pow(height, 2);
		return bmiValue;
	}
	
	public String shortMessage() {
		if(bmiValue < 18.5) {
			return "hi " + name + " 你的體重過輕!";
		} else if(bmiValue >= 18.5 && bmiValue < 24) {
			return "hi " + name + "你的身高與體重正常";
		} else
			return "hi " + name + "你的體重過重!";
	}
}
